<include file="__THEME__/header" />
<link href="../Public/css/photo.css" rel="stylesheet" type="text/css" />
<script>
	var APP_NAME = "{$ts['app']['app_alias']}";
</script>
<div class="content_holder">
<div class="content no_bg">
<include file="../Public/_mainNav" />
  <div class="main no_l">
    <div class="mainbox"> 
      <include file="../Public/_isHotList" />
      <div class="mainbox_appC">
		<div class="tab-menu"><!-- 切换标签 begin  -->
		<ul>
			<li><a href="{:U('/Upload/index')}"><span>普通上传</span></a></li>
			<li><a href="{:U('/Upload/flash')}" class="on"><span>批量上传</span></a></li>
			<if condition="$setting['open_camera'] eq 1"><li><a href="{:U('/Upload/camera')}"><span>在线拍照</span></a></li></if>
            <li><a href="{:U('/Index/photos')}"><span>返回我的图片</span></a></li>
		</ul>
		</div><!-- 切换标签 end  -->
		
		<div class="photoBox">
			<div class="upload">
			<ul style="width:60%;">
            <form method="post" action="{:U('/Upload/muti_edit_photos')}" enctype="application/x-www-form-urlencoded" name="muti_edit_photos" id="muti_edit_photos">
        	<li><div class="c1">选择图片{$ts['app']['app_alias']}：</div>
				<div class="c2">
                {:W('AlbumList',array( 'uid'=>$mid , 'form_name'=>'albumId' , 'selected'=>intval($_GET['albumId']) ) )}
                <a href="javascript:create_album_tab({$mid});">[创建{$ts['app']['app_alias']}]</a>
				</div>
        	</li>     
            <li>
				<div class="c1"><input type="hidden" name="upnum" id="up_num" value="0" />
                	<span id="flash_upload_select_picture"></span>
				</div>
              <div class="c2">
                <div class="rank" id="flash_upload_progress" style="border:solid 1px #CCC;height:220px; overflow: scroll;"></div>
                </div>
        	</li>
            <li>
              	<div class="c1">
					&nbsp;
                </div>
                <div class="c2">
               		<input type="button" class="btn_b" value="开始上传" id="btnUpload" onClick='start_upload()' disabled="disabled" />
                </div>
        	</li>
			<!--<li>
              <div class="c1">&nbsp;</div>
                <div class="c2"><input name="" type="checkbox" value="" /> 
                添加到{$ts['app']['app_alias']}后面 </div>
        	</li> -->
        </form>
        </ul>
        <div class="clue">
			<p>·可以同时选择多张图片进行批量上传 (注:一次最多同时上传{$max_flash_upload_num}张图片)    </p>
			<p>·单张图最大为{$photo_max_size/1024/1024}M，支持{$photo_file_ext}格式，如果上传失败，请尝试小一点的图片。</p>
			<p>·切换到缩略图模式预览文件夹<br /> 可直观挑选图片： <img src="../Public/images/uploadEx.gif" width="136" height="27" /></p>
			<span class="clue_btm"></span>
		</div>
		<!-- 上传图片预览 -->
		<div id="uploaded_photos" style="clear:both;"></div>
    </div>
    </div>  
    <div class="clear"></div> 
	</div>
	</div> 
	
</div> <!-- 右侧内容 end  -->
</div>
</div>
<!-- 内容 end -->
<include file="__THEME__/footer" />
<script src="../Public/js/album.js" type="text/javascript"></script>
<link href="../Public/js/swfupload/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../Public/js/swfupload/swfupload.js"></script>
<script type="text/javascript" src="../Public/js/swfupload/swfupload.queue.js"></script>
<script type="text/javascript" src="../Public/js/swfupload/fileprogress.js"></script>
<script type="text/javascript" src="../Public/js/swfupload/handlers.js"></script>
<script>
	var swfu;
	window.onload = function() {
		var settings = {

			// Backend Settings
			upload_url: "{:U('/Upload/upload_single_pic')}",	// Relative to the SWF file (or you can use absolute paths)
			post_params: {"PHPSESSID" : "<?php echo session_id(); ?>"},

			// File Upload Settings
			file_size_limit : "2048",	// 3MB
			file_types : "*.jpg;*.gif;*.png;*.bmp",
			file_types_description : "All Files",
			file_upload_limit	:	"{$max_flash_upload_num}",	//最多上传30张
			file_queue_limit	:	"{$max_flash_upload_num}",	//最多选择30张

			// Event Handler Settings (all my handlers are in the Handler.js file)
			file_dialog_start_handler :		fileDialogStart,
			file_queued_handler :			fileQueued,
			file_queue_error_handler :		fileQueueError,
			file_dialog_complete_handler :	fileDialogComplete,
			upload_start_handler :			uploadStart,
			upload_progress_handler :		uploadProgress,
			upload_error_handler :			uploadError,
			upload_success_handler :		uploadSuccess,
			upload_complete_handler :		uploadComplete,
			queue_complete_handler :		queueComplete,

			// Button Settings
			button_image_url : "../Public/js/swfupload/add_photo.png",	// Relative to the SWF file
			button_placeholder_id : "flash_upload_select_picture",
			button_width:	74,
			button_height:	25,

			// Flash Settings
			flash_url : "../Public/js/swfupload/swfupload.swf",

			custom_settings : {
				progressTarget : "flash_upload_progress",
				cancelButtonId : "btnCancel1"
			},
			debug: false
		};

		swfu = new SWFUpload(settings);
	};

//开始上传
function start_upload(){
	albumId	=	$('#albumlist').val();
	if(albumId>0){
		swfu.addPostParam('albumId',albumId);
		swfu.startUpload();
		$('#btnUpload').attr('disabled',true).removeClass('btn5').val("上传中...");
	}else{
		alert('图片{$ts['app']['app_alias']}未选择，请添加新{$ts['app']['app_alias']}或者刷新页面重试！');
	}
}

//单图上传回调函数,返回上传完成文件的信息
function ts_upload_success(serverData){
	var data	=	eval('('+serverData+')');
	if(data.status==true){
		return true;
	}else{
		alert(data.info);
		return true;
	}
}

//当文件队列有文件时
function enableUploadButton(file){
	$('#btnUpload').attr('disabled',false).addClass('btn5').val("开始上传");
}
//全部上传完成
function queueComplete(numFilesUploaded) {
	$("#up_num").val(numFilesUploaded);
	$("#muti_edit_photos").submit();
}
</script>